package com.sky.mapper;

import com.sky.domain.WmsWareOrderTaskDetail;
import com.sky.domain.WmsWareSku;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
* @author Administrator
* @description 针对表【wms_ware_sku(商品库存)】的数据库操作Mapper
* @createDate 2024-06-30 16:47:16
* @Entity com.sky.domain.WmsWareSku
*/
public interface WmsWareSkuMapper extends BaseMapper<WmsWareSku> {

    /**
     * @param skuId:
     * @return List<WmsWareSku>
     * @author zhl
     * @description 查询还有商品库存的仓库id
     * @date 2024/9/3 10:01
     */
    List<WmsWareSku> listHasStock(@Param("skuId") Long skuId);

    /**
     * @param skuId: 商品id
     * @param wareId: 仓库id
     * @param num: 商品数量
     * @return int
     * @author zhl
     * @description 锁定商品库存
     * @date 2024/9/3 10:11
     */
    int lockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);

    /**
     * 订单解锁库存
     *
     * @param detail
     */
    void unLockStock(@Param("param") WmsWareOrderTaskDetail detail);

    /**
     * 订单扣减库存
     *
     * @param detail
     */
    void deductionStock(@Param("param") WmsWareOrderTaskDetail detail);
}




